<template>
	<f-popup ref="popup" position="bottom">
		<view class="audit-option">
			<view class="head">
				<view class="title">
					<view>审核</view>
					<!-- <view class="sub-title">请选择您学生证对应的学校</view> -->
				</view>
				<view class="close" @click="close">
					<text class="iconfont icon-close"></text>
				</view>
			</view>
			
			<view class="content">
				<view class="form">
					<view class="form-item">
						<view class="form-label">审核状态<text style="color: red;">*</text></view>
						<view class="form-body" style="border-bottom: none;">
							<view class="radio-group">
								<label class="f-radio" :class="{'f-is-checked': item.value === formData.is_audit}" v-for="item in options" :key="item.value" @click="changeType(item, 'is_audit')">
									<input type="radio" name="sex" :data-value="item.value" disabled class="f-radio_former" :value="item.value" data-allow-uncheck="true" />
									<text class="f-radio_input"></text>
									<text class="f-radio_label">{{ item.label }}</text>
								</label>
							</view>
						</view>
					</view>
					<view class="form-item">
						<view class="form-label">审核描述</view>
						<view class="form-body" style="border-bottom: none;">
							<view class="textarea">
								<textarea type="text" v-model="formData.audit_msg" placeholder="请输入审核描述" placeholder-class="placeholder-class" />
							</view>
						</view>
					</view>
				</view>
				
				<view class="footer-btns">
					<button class="confirm-btn flex-1" @click="submit">提交</button>
				</view>
			</view>
		</view>
	</f-popup>
</template>

<script>
	export default {
		name: 'audit-option',
		props: {
			gid: String
		},
		data() {
			return {
				formData: {
					audit_msg: '',
					is_audit: 1
				},
				
				options: [
					{ label: '驳回', value: -1 },
					{ label: '通过', value: 1 },
				],
			};
		},
		methods: {
			submit() {
				this.$api.agentUserIdentityAuditApi(this.gid, this.formData).then(res=> {
					uni.showToast({
						icon: 'none',
						title: '提交成功',
					})
					this.close()
					this.$emit('refresh')
				}).catch(err=> {
					console.log('err', err);
				})
			},
			changeType(item, key) {
				this.formData[key] = item.value
			},
			open() {
				this.$refs.popup.open()
			},
			close() {
				this.$refs.popup.close()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.audit-option {
		width: 100%;
		min-height: 50vh;
		background-color: #FFFFFF;
		border-radius: 24rpx 24rpx 0 0;
		
		
		.head {
			position: relative;
			width: 100%;
			padding: 32rpx;
			display: flex;
			min-height: 116rpx;
			align-items: center;
			padding-bottom: 8rpx;
			box-sizing: border-box;
			justify-content: center;
			
			.title {
				font-size: 36rpx;
				font-weight: 600;
				line-height: 52rpx;
				text-align: center;
				color: rgba(0, 0, 0, 0.9);
			}
			
			.sub-title {
				font-size: 24rpx;
				font-weight: 400;
				text-align: left;
				line-height: 40rpx;
				color: rgba(0, 0, 0, 0.4);
			}
			
			.close {
				position: absolute;
				right: 32rpx;
				
				.icon-close {
					font-size: 24rpx;
				}
			}
		}
		
		.content {
			padding: 0 32rpx;
			padding-bottom: calc(200rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
			padding-bottom: calc(200rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
		}
		
		.form {
			padding-top: 32rpx;
		
			.form-item {
				padding-bottom: 32rpx;
		
				&:last-child {
					padding-bottom: 0;
				}
			}
		
			.form-label {
				font-size: 28rpx;
				font-weight: 400;
				text-align: left;
				line-height: 44rpx;
				padding-bottom: 8rpx;
				color: rgba(0, 0, 0, 0.9);
			}
		
			.form-body {
				padding-bottom: 12rpx;
				border-bottom: 1px solid #E7E7E7;
			}
		
			.input {
				width: 100%;
				height: 72rpx;
				display: flex;
				align-items: center;
		
				input {
					flex: 1;
					height: 100%;
				}
			}
		
			.hint {
				font-size: 24rpx;
				font-weight: 400;
				text-align: left;
				line-height: 40rpx;
				padding-bottom: 10rpx;
				color: rgba(0, 0, 0, 0.4);
			}
		
			.right-btn {
				position: relative;
				padding: 0 32rpx;
				height: 48rpx;
				color: var(--primary-color);
				font-size: 32rpx;
				font-weight: 400;
				line-height: 48rpx;
				text-align: center;
				line-height: 48rpx;
		
				&:before {
					position: absolute;
					content: '';
					top: 5%;
					left: 0;
					bottom: 0;
					width: 1px;
					height: 90%;
					background-color: #E7E7E7;
				}
			}
			.radio-group {
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				gap: 42rpx;
				flex-shrink: 0;
				min-height: 72rpx;
			
				.f-radio {
					font: 28rpx / calc(28rpx + 16rpx) PingFang SC, Microsoft YaHer, Arial Regular;
					color: var(--primary-color);
					box-sizing: border-box;
					margin: 0;
					padding: 0;
					list-style: none;
					position: relative;
					cursor: pointer;
					display: inline-block;
			
					.f-radio_former {
						border: 0;
						clip: rect(0 0 0 0);
						height: 1px;
						margin: -1px;
						overflow: hidden;
						padding: 0;
						position: absolute;
						width: 1px;
						outline: 0;
						appearance: none;
						display: none;
					}
			
					.f-radio_input {
						position: relative;
						display: inline-block;
						width: 18px;
						height: 18px;
						vertical-align: middle;
						border-radius: 999px;
						border: 1px solid #DCDCDC;
						background-color: #FFFFFF;
						transition: border .2s cubic-bezier(0, 0, .15, 1);
			
						&::after {
							position: absolute;
							content: "";
							top: 0;
							left: 0;
							right: 0;
							bottom: 0;
							width: 100%;
							height: 100%;
							opacity: 0;
							border-radius: 999px;
							box-sizing: border-box;
							border: 8rpx solid var(--primary-color);
							transition: all .2s cubic-bezier(0, 0, .15, 1);
						}
					}
			
					.f-radio_label {
						min-width: 56rpx;
						margin-left: 16rpx;
						white-space: nowrap;
						vertical-align: middle;
						display: inline-block;
						color: rgba(0, 0, 0, 0.9);
						font: 28rpx / calc(28rpx + 16rpx) PingFang SC, Microsoft YaHer, Arial Regular;
					}
				}
			
				.f-is-checked {
			
					.f-radio_input {
						border-color: var(--primary-color);
			
						&::after {
							opacity: 1;
						}
					}
				}
			}
			.textarea {
				height: 168rpx;
				padding: 20rpx 32rpx;
				border-radius: 12rpx;
				box-sizing: border-box;
				border: 1px solid #DCDCDC;
			
				textarea {
					width: 100%;
					height: 100%;
					font-size: 32rpx;
					font-weight: 400;
					line-height: 48rpx;
					text-align: left;
				}
			}
			
		}
	
		
		.footer-btns {
			position: fixed;
			left: 0;
			right: 0;
			bottom: 0;
			width: 100%;
			z-index: 999;
			padding: 20rpx 32rpx;
			box-sizing: border-box;
			background-color: #FFFFFF;
			box-shadow: 0px 0px 33rpx rgba(0, 0, 0, 0.05);
			padding-bottom: calc(20rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
			padding-bottom: calc(20rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
		
			gap: 14rpx;
			display: flex;
			align-items: center;
		}
	}
</style>
